package pack1;

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.apache.bcel.generic.RETURN;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.server.handler.SendKeys;

public class sprg22 {
public static void main(String[] args) throws InterruptedException {
	WebDriver driver=new FirefoxDriver();
	driver.manage().window().maximize();
	driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
	driver.get("http://www.facebook.com");
	driver.findElement(By.id("email")).sendKeys("");//enter id
	Thread.sleep(1000);
	driver.findElement(By.id("pass")).sendKeys(""); ///enter password
	Thread.sleep(1000);
	driver.findElement(By.xpath("//input[@type='submit']")).sendKeys(Keys.RETURN);
	driver.findElement(By.name("notifications")).click();
  driver.findElement(By.xpath("//div[@id='userNavigationLabel']")).click();
	List<WebElement> allOption = driver.findElements(By.id("userNavigation"));
	
	for(int i=0;i<allOption.size();i++)
	{System.out.println(allOption.get(i).getText());
	}
	//driver.findElement(By.xpath("//label[@class='uiLinkButton navSubmenu']")).click();
	System.out.println("done");
	//ul id="userNavigation" class="navigation" aria-label="Account Menu" role="menu navigation"

	Actions action=new Actions(driver);
	WebElement logOut = driver.findElement(By.xpath("//label[@class='uiLinkButton navSubmenu']"));
	action.moveToElement(logOut).perform();
	action.click().perform();
	driver.close();
	
	
}
}
